package cn.wolfcode.trip.base.service.impl;


import cn.wolfcode.trip.base.domain.DailyComment;
import cn.wolfcode.trip.base.domain.UserChat;
import cn.wolfcode.trip.base.mapper.DailyCommentMapper;
import cn.wolfcode.trip.base.mapper.UserChatMapper;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.IDailyCommentService;
import cn.wolfcode.trip.base.service.IUserChatService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class UserChatServiceImpl implements IUserChatService {
    @Autowired
    private UserChatMapper userChatMapper;


    @Override
    public List<UserChat> getAllUsers(Long myUserId) {
        return userChatMapper.selectAllUsers(myUserId);
    }

    @Override
    public UserChat getAcceptUser(Long acceptUserId) {
        return userChatMapper.selectAcceptUser(acceptUserId);
    }

    @Override
    public List<UserChat> getMessages(Long sendId,Long currentId) {
        return userChatMapper.selectMessages(sendId,currentId);
    }

    @Override
    public void saveMessage(UserChat userChat) {
        userChat.setCreateTime(new Date());
        userChatMapper.insert(userChat);
    }

    @Override
    public List<UserChat> getNewMessages(Long sendId, Long currentId) {
        return userChatMapper.getNewMessages(sendId,currentId);
    }

    @Override
    public Integer getCounts(Long sendId, Long currentId) {
        return userChatMapper.getCounts(sendId,currentId);
    }

    @Override
    public List<UserChat> getAllSendUsers(Long myUserId) {
        return userChatMapper.getAllSendUsers(myUserId);
    }
}
